package com.javabi.boardgame.model.status;

import java.util.HashMap;
import java.util.Map;

import com.javabi.boardgame.model.IPlayer;

public class StatusMap<S extends IStatus> {

	private final Map<IPlayer, S> map = new HashMap<IPlayer, S>();

	public void put(IPlayer player, S status) {
		if (player == null) {
			throw new NullPointerException("player");
		}
		if (status == null) {
			throw new NullPointerException("status");
		}
		map.put(player, status);
	}

	public S get(IPlayer player) {
		if (player == null) {
			throw new NullPointerException("player");
		}
		S status = map.get(player);
		if (status == null) {
			throw new IllegalArgumentException("unknown player: " + player);
		}
		return status;
	}

}
